﻿
CREATE PROCEDURE [dbo].[exBug_AfiseazaParteneriFolositi]
	@CodUnitate smallint, 
	@Afiseaza bit
AS
BEGIN
	SET NOCOUNT ON;

	SELECT * FROM Parteneri p
	WHERE CodUnitate = @CodUnitate
	AND ((@Afiseaza=0) OR EXISTS (SELECT * FROM [Ordonantari] o WHERE o.CodUnitate=@CodUnitate AND o.IDFurnizor=p.IDPartener))
END